import {themes as prismThemes} from 'prism-react-renderer';
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';

// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)

const config: Config = {
  title: '开放原子开源运营专区',
  tagline: '',
  favicon: 'img/favicon.ico',
  
  // Set the production url of your site here
  url: 'https://pop.openatom.cn',
  // Set the /<baseUrl>/ pathname under which your site is served
  // For GitHub pages deployment, it is often '/<projectName>/'
  baseUrl: '/',

  // GitHub pages deployment config.
  // If you aren't using GitHub pages, you don't need these.
  // organizationName: 'facebook', // Usually your GitHub org/user name.
  // projectName: 'docusaurus', // Usually your repo name.

  onBrokenLinks: 'throw',
  onBrokenMarkdownLinks: 'warn',

  // Even if you don't use internationalization, you can use this field to set
  // useful metadata like html lang. For example, if your site is Chinese, you
  // may want to replace "en" with "zh-Hans".
  i18n: {
    defaultLocale: "zh-CN",
    locales: ["zh-CN", "en"],
    localeConfigs: {
      "zh-CN": {
        htmlLang: "zh-CN",
      },
    },
  },

  presets: [
    [
      'classic',
      {
        docs: {
          sidebarPath: './sidebars.ts',
          // Please change this to your repo.
          // Remove this to remove the "edit this page" links.
          editUrl:
            'https://atomgit.com/oadev/pop',
        },
        blog: {
          showReadingTime: true,
          feedOptions: {
            type: ['rss', 'atom'],
            xslt: true,
          },
          // Please change this to your repo.
          // Remove this to remove the "edit this page" links.
          editUrl:
            'https://atomgit.com/oadev/pop',
          // Useful options to enforce blogging best practices
          onInlineTags: 'warn',
          onInlineAuthors: 'warn',
          onUntruncatedBlogPosts: 'warn',
        },
        theme: {
          customCss: './src/css/custom.css',
        },
        sitemap: {
          ignorePatterns: undefined,
          lastmod: 'date',
          priority: null,
          changefreq: null,
        },
      } satisfies Preset.Options,
      
    ],
  ],

  plugins: [
    
  ],
  themes: [
    // ... Your other themes.
    [
      require.resolve("@easyops-cn/docusaurus-search-local"),
      /** @type {import("@easyops-cn/docusaurus-search-local").PluginOptions} */
      ({
        // ... Your options.
        // `hashed` is recommended as long-term-cache of index file is possible.
        hashed: true,

        // For Docs using Chinese, it is recomended to set:
        language: ["zh"],

        // If you're using `noIndex: true`, set `forceIgnoreNoIndex` to enable local index:
        // forceIgnoreNoIndex: true,
        highlightSearchTermsOnTargetPage: true,
        indexDocs: true,
        indexBlog: true,
        indexPages: true,
        explicitSearchResultPath: true,
      }),
    ],
  ],
  themeConfig: {
    // Replace with your project's social card
    image: 'img/car.jpg',
    navbar: {
      title: '开放原子开源运营专区',
      logo: {
        alt: '开放原子开源运营专区',
        src: 'img/logo.jpg',
      },
      items: [
        {
          to: 'showcase',
          label: '用户案例',
          position: 'left'
        },
        {
          type: 'doc',
          position: 'left',
          docId: 'index',
          label: '文档',
        },
        {
          to: 'changelog',
          label: '更新动态',
          position: 'left',
        },
      ],
    },
    footer: {
      style: 'dark',
      links: [
        {
          title: '关于我们',
          items: [
            {
              label: '开放原子开源基金会官网',
              to: 'https://openatom.cn',
            },
            {
              label: '开放原子开源基金会人才评价系统',
              to: 'https://talent.openatom.cn',
            },
          ],
        },
        {
          title: '优秀社区展示',
          items: [
            {
              label: '开源小满 EasyXMen',
              href: 'https://easyxmen.atomgit.com',
            },

            {
              label: '黄鹤开源社区',
              href: 'https://huanghe.atomgit.com',
            },
            {
              label: 'OpenAtom 开源社区',
              href: 'https://openatom.atomgit.com',
            },
          ],
        },
        {
          title: '联系我们',
          items: [
            {
              label: '资金捐赠',
              href: 'mailto:sponsorship@openatom.org',
            },
            {
              label: '项目募集',
              href: 'mailto:foss-project@openatom.org',
            },
            {
              label: '法律问题',
              href: 'mailto:legal@openatom.org',
            },
          ],
        },
      ],
      copyright: `Copyright © ${new Date().getFullYear()} AtomGit, Inc. Built with Docusaurus.`,
    },
    prism: {
      theme: prismThemes.github,
      darkTheme: prismThemes.dracula,
    },
  } satisfies Preset.ThemeConfig,
};

export default config;
